UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rCqrOzYE0Eer9VDy9VPAYEo3/JIvEwNzYNmbuBI1RFo=' 
WHERE 
  key_id = '9af4a660ea89f6d4971a50cfe0ebf32165f570cb48f9f73c03196185d016900a' 
  AND (
    token = 'rCqrOzYE0Eer9VDy9VPAYEo3/JIvEwNzYNmbuBI1RFo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021