UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VkWB2tRCQz9PKEF02vGYPchPMcN/bdznswlcnuz6fZs=' 
WHERE 
  key_id = '67948797ab657d4eba184732fbcbea747086464375d5bbe19abe3c5c2ec4b0a6' 
  AND (
    token = 'VkWB2tRCQz9PKEF02vGYPchPMcN/bdznswlcnuz6fZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032