UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JC9Rx4sOXeyj4ink4G7G45jsi0fTq3+PJm0jwgmFP8Y=' 
WHERE 
  key_id = '21fe3887d380b82543d29d7edd6d4add4c0799307beae857e54d31e9386f98d7' 
  AND (
    token = 'JC9Rx4sOXeyj4ink4G7G45jsi0fTq3+PJm0jwgmFP8Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041