UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yX/ZiN3PdCbc7SxGCKM8pGaBfZ8m4cff7gMfwV9cO08=' 
WHERE 
  key_id = 'a6cc595222453ca147bb0467a2281bf20fc4e661ee47a84b183a57c95a32795b' 
  AND (
    token = 'yX/ZiN3PdCbc7SxGCKM8pGaBfZ8m4cff7gMfwV9cO08=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046