UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7MN5xtOw8sdmiLsv9NqVV6iB3iF5qOcaEaUUKBdDW5Y=' 
WHERE 
  key_id = '3b1dcd1421b30abaa32332e0f458d2f2a50c1a558f31341dce7640e73789eab2' 
  AND (
    token = '7MN5xtOw8sdmiLsv9NqVV6iB3iF5qOcaEaUUKBdDW5Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036