UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PLW2jordSjtAem37lE1SdHdB+LZxA5OcQKPEvanvUNo=' 
WHERE 
  key_id = 'ee32267013db54899ad5ddecf87f08b96e0c093fbc17101a57395550ab68c51d' 
  AND (
    token = 'PLW2jordSjtAem37lE1SdHdB+LZxA5OcQKPEvanvUNo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048