UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DgKhVYXWmAzXeKDDIiCziXxMlnU14+dmzoy5JwRRSGc=' 
WHERE 
  key_id = '825ff2982b23d8725a40a67aff1d611837158e96e14b22dae90278491e2a7986' 
  AND (
    token = 'DgKhVYXWmAzXeKDDIiCziXxMlnU14+dmzoy5JwRRSGc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034