UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H2sXoYw+HPOrTswYCKM9DsJqRTXWoznUHo5IHBKM0js=' 
WHERE 
  key_id = '4cdbd4ec1a2c0285b7376ec81ed9a0f0be5a757c503c2b356be08f9baba58d57' 
  AND (
    token = 'H2sXoYw+HPOrTswYCKM9DsJqRTXWoznUHo5IHBKM0js=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030