UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KrSJTij5VpYqnXpkH2c9FmCU1D+kD72+EKTSZQ55NVM=' 
WHERE 
  key_id = '0321cabfd4c61d47b10c62cb852e8b08b9e23160499b0066b5093f54230cdbff' 
  AND (
    token = 'KrSJTij5VpYqnXpkH2c9FmCU1D+kD72+EKTSZQ55NVM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031