UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CCWms1hY58a3EmSxmcFiasi2nsXtgh9vtj+DjaNzdqA=' 
WHERE 
  key_id = '13517c9def89c17a87d8eef1e05e5a39a4b7ce0ba8655bccbc3346baa5b5f5c9' 
  AND (
    token = 'CCWms1hY58a3EmSxmcFiasi2nsXtgh9vtj+DjaNzdqA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023