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

Query time 0.00043