UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r90SfJj1BtXkWNozNVH3+F6MboKfseBwgS/q6t0DUFA=' 
WHERE 
  key_id = 'c77a832fd24b7d9440b33f6793626d8f4cf3cf7314a03e2781bcdb1e02ffec1d' 
  AND (
    token = 'r90SfJj1BtXkWNozNVH3+F6MboKfseBwgS/q6t0DUFA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030