UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lLV6ePOz4wM0s4YFJcbYofvzLwIIU+yKVbizkKwuevE=' 
WHERE 
  key_id = '69b3715da3e2ebda42e9feccbf76522e8924e5ed227a743aedf3807f8bd57f03' 
  AND (
    token = 'lLV6ePOz4wM0s4YFJcbYofvzLwIIU+yKVbizkKwuevE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024