UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aVeGfflgezDBwHfNyffwwkemTcUSleITJy0174MWoUA=' 
WHERE 
  key_id = 'ace20d66541fdd8126d7dfc87b87d00c29ddb2071e0403dd141583e9a781745f' 
  AND (
    token = 'aVeGfflgezDBwHfNyffwwkemTcUSleITJy0174MWoUA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046