UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7oYi1Y8XQRUhmVJVyAj0L2SRDIv1VR+hGuHOp5eN01U=' 
WHERE 
  key_id = '1053b4eb8a044e3086cbb5c1e8fe73a3c0eab449bf5add2d371be357055d450b' 
  AND (
    token = '7oYi1Y8XQRUhmVJVyAj0L2SRDIv1VR+hGuHOp5eN01U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034