UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lcBf3fmemz+g7oF3zO4ED56CHJSnnJBHceeQ+w7tOys=' 
WHERE 
  key_id = '4823b33c17f879e73840b86939280e77074508aee18f4b4cafe44468cd3335a9' 
  AND (
    token = 'lcBf3fmemz+g7oF3zO4ED56CHJSnnJBHceeQ+w7tOys=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050