UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CDSI8siTY5Qlzpc4L6p+m3aSaYhEgzbUkHMiWmYJKS0=' 
WHERE 
  key_id = 'aa1afade444e4fd030a2e82aff40aecbdb467b6b88c05840145e90dfa171f705' 
  AND (
    token = 'CDSI8siTY5Qlzpc4L6p+m3aSaYhEgzbUkHMiWmYJKS0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032