UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B69DXqM3ME7fAkqmjpl3OjPqbda9vSuRmTVRqugC8Es=' 
WHERE 
  key_id = '17ea43648607e79451a1b2e298af0a7cf6d96b9deefe9d8076fbda94d0c24acf' 
  AND (
    token = 'B69DXqM3ME7fAkqmjpl3OjPqbda9vSuRmTVRqugC8Es=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031