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

Query time 0.00030