UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uRw9smCGRljMAgSVc0+xHsBz91dMJ+GN7qfb25Ccyy4=' 
WHERE 
  key_id = '78ea577488b1f1341f66333a41eb8380b52a1161b1e06ade46ee1146c85ef479' 
  AND (
    token = 'uRw9smCGRljMAgSVc0+xHsBz91dMJ+GN7qfb25Ccyy4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028