UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G4Tn/M6U1w5+EZm/CkhUkEhKJn7weRL1M263cT4NlWk=' 
WHERE 
  key_id = '37916a38b9a690891219cca4d2e23bc18bae388ea1e7608b59d92ac879be0d76' 
  AND (
    token = 'G4Tn/M6U1w5+EZm/CkhUkEhKJn7weRL1M263cT4NlWk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035