UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ieN3jGWuc7lFVdxZtEoWie9PK9pyB1ruBvNodZgNJ5w=' 
WHERE 
  key_id = '6e0c56b48cdbc19ded927bd60ba64756838480cb086bba3112c6d0b75bc4654d' 
  AND (
    token = 'ieN3jGWuc7lFVdxZtEoWie9PK9pyB1ruBvNodZgNJ5w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026