UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'brxVoKtgQYUA1lbNWfYrV4NeKreXL4Kmp5G+RqjxD08=' 
WHERE 
  key_id = '594cd4df02f9fb3cfc49d7d0b73ee69d66267d5f8c18250b32c41a3303347067' 
  AND (
    token = 'brxVoKtgQYUA1lbNWfYrV4NeKreXL4Kmp5G+RqjxD08=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028