UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TqDQtyWX3I4HJuPrS8HOZgrYJlYf0nurQ0RBwovB1K8=' 
WHERE 
  key_id = '172ca0e576684b91f9d537f912a3b20941cfabed1f27969cefdc3c1602653d68' 
  AND (
    token = 'TqDQtyWX3I4HJuPrS8HOZgrYJlYf0nurQ0RBwovB1K8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028