UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DK9cWMbNpt0piskr7fjcc95+rJKc0IASRlj6KjjUHT8=' 
WHERE 
  key_id = 'ffe3b5111abd64217cff486424765f33df9457cf15e3b6412107104de84d55ad' 
  AND (
    token = 'DK9cWMbNpt0piskr7fjcc95+rJKc0IASRlj6KjjUHT8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027