UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ORYpump2yxJYkUh9SifLS6/2zA6gy4292mZdi1B/mMI=' 
WHERE 
  key_id = '30684050f28c9e3bfcd9d00d1037b0c8b8c61156d0ab9ec765443dcfcef2ea8c' 
  AND (
    token = 'ORYpump2yxJYkUh9SifLS6/2zA6gy4292mZdi1B/mMI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038