UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lbJzlx1InAqBgKGQIYHJ1+p1RjhReSY/YBNeARIh+Dk=' 
WHERE 
  key_id = 'f62b1073ed526c59d957d50c11ac0a9657dcfd492be1043eeba2728999541432' 
  AND (
    token = 'lbJzlx1InAqBgKGQIYHJ1+p1RjhReSY/YBNeARIh+Dk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035