UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a7QnIULQhWlJtDjs53hJwf57amhqvDIy2AfCGOYpF4Q=' 
WHERE 
  key_id = '5f37c79a94cdaa9cf79437d8b6d86cc58c5903f959220cd08576bba2ffd6fd83' 
  AND (
    token = 'a7QnIULQhWlJtDjs53hJwf57amhqvDIy2AfCGOYpF4Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022