UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YkyedSO3pciP7rEHP6uGPFtxD2lW68wNQaNg4AGKd1U=' 
WHERE 
  key_id = 'df5dea7fbf802705d511677482a687039869397815d3c347b85c1244e3f876ee' 
  AND (
    token = 'YkyedSO3pciP7rEHP6uGPFtxD2lW68wNQaNg4AGKd1U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048