UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'buFsDoU+c/QqcqJYc11x7biCemILwZSWELcvy1wy6EU=' 
WHERE 
  key_id = '81b58f7697bf7b4f6d80ecb29389e75c3e14f5479ec752e594cc49a1e7f754fa' 
  AND (
    token = 'buFsDoU+c/QqcqJYc11x7biCemILwZSWELcvy1wy6EU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033