UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AFZNuwj8sr4Xi8lPeniRJEz9PvSkmsgaE0PmXFswQb0=' 
WHERE 
  key_id = 'd0d6dbe6b86a7285a61fa483c5c0369d0b5228b9e479a5ccbb5da0602d4c7705' 
  AND (
    token = 'AFZNuwj8sr4Xi8lPeniRJEz9PvSkmsgaE0PmXFswQb0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038