UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FAPh5hg0FcWJ05oGZujSZ9beFmigVaGcTYj/fmfqA/0=' 
WHERE 
  key_id = '4fd75f2b48a33a24dd530f8d5ed4c40b8aac11d6dd2159acb538212513bc3054' 
  AND (
    token = 'FAPh5hg0FcWJ05oGZujSZ9beFmigVaGcTYj/fmfqA/0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026