UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HoyxjqBege9qPJJDsH7kn2t+riY6TTSnhom8pBQccak=' 
WHERE 
  key_id = 'd1373c750a91a2f9525b50df9c5020049ee86211d7c830455f66705cbd624c4e' 
  AND (
    token = 'HoyxjqBege9qPJJDsH7kn2t+riY6TTSnhom8pBQccak=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044