UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mLzxte3GLsjbBPC5XfCUlnB2w9BSQUu5Dym6eaORAIc=' 
WHERE 
  key_id = 'c9bd08e65871f02a5e211156a09d7cc1a661a2af492f9963407dc74c1b331639' 
  AND (
    token = 'mLzxte3GLsjbBPC5XfCUlnB2w9BSQUu5Dym6eaORAIc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020