UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nMqedi8ESVtqUfeM4/paNvj3AIf8aHka8EwOosvgZjo=' 
WHERE 
  key_id = '5450cf6c810d2c5a42df68bfee3b619155b84605751e385ac8ffa413de44dc40' 
  AND (
    token = 'nMqedi8ESVtqUfeM4/paNvj3AIf8aHka8EwOosvgZjo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00067