UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SPUCcaaNIuljmx5bVEk3iK0222cNCX63CvKiUQ0GCXI=' 
WHERE 
  key_id = '66d375b9ef1ca9cdb8416eb9ce6fcd7ca62bc461da5d3178aa8304c85c40d5c6' 
  AND (
    token = 'SPUCcaaNIuljmx5bVEk3iK0222cNCX63CvKiUQ0GCXI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046