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

Query time 0.00029