UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J4hVSZxL7CAq01N7XTa0xsHiqFDJUTykyRQRklc1P1g=' 
WHERE 
  key_id = '1b78442987ccc5777539629856aa439e2638e492cae72e92ce3803d2a8e52ef0' 
  AND (
    token = 'J4hVSZxL7CAq01N7XTa0xsHiqFDJUTykyRQRklc1P1g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032