UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '46Qe7nk5fY+5iyAJFA9JEsB9vNDqOr25hAule914gBI=' 
WHERE 
  key_id = '7ba23a1f9bd434190ba0794cce925be3f011e18076b87ca5fefb803f75f27398' 
  AND (
    token = '46Qe7nk5fY+5iyAJFA9JEsB9vNDqOr25hAule914gBI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033