UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SWCn+FWUF/Cm2h4g/1/Fb7xi+90j86lC3FvahY33AtA=' 
WHERE 
  key_id = '1a041ba3a3147ec10a3dd75be0b77a7f2fc2e36edec2979c1f14d9e9949fd167' 
  AND (
    token = 'SWCn+FWUF/Cm2h4g/1/Fb7xi+90j86lC3FvahY33AtA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030