UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pOWwASf4Uv7G6W1RXaikdhHzFUsRftHfX+Myd0nCN88=' 
WHERE 
  key_id = '71bc47c42bdcebc1715cb8c41b43d8c6730e5c2075bf4342c3761eb79b63ff62' 
  AND (
    token = 'pOWwASf4Uv7G6W1RXaikdhHzFUsRftHfX+Myd0nCN88=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016