UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ccr370U+1JIhMWxWgCxS5MM315v/dDmfDnr7+msIUQ4=' 
WHERE 
  key_id = '89416fad8ec2906656de3f3b0bcd92c8fec93f7363642d0049c4abade0dad34f' 
  AND (
    token = 'ccr370U+1JIhMWxWgCxS5MM315v/dDmfDnr7+msIUQ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028