UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XdQw5yLJuMxbccFMU5795BL3p3QMvft7RqryCa6tIQE=' 
WHERE 
  key_id = '374ca3bd6c28ccadf83b2469b150e43677f47decf357945763316059d77e6f95' 
  AND (
    token = 'XdQw5yLJuMxbccFMU5795BL3p3QMvft7RqryCa6tIQE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017