UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SlBEu9GfMlTrVGUB/qxL6v6nW8CsnXPdcFelzhI/aW4=' 
WHERE 
  key_id = '40f48e7df35e2ac1535f591711b85e2e385382d9b7c931395ed237bafafa4a7e' 
  AND (
    token = 'SlBEu9GfMlTrVGUB/qxL6v6nW8CsnXPdcFelzhI/aW4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049