UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cTfjMqS+1zCs05PWe05aGU1lWqpGJGK9KkNAky8rB2M=' 
WHERE 
  key_id = 'c51e170fa3658aa19398b56047550a17a415a49f0b6a8f2086642374845e470a' 
  AND (
    token = 'cTfjMqS+1zCs05PWe05aGU1lWqpGJGK9KkNAky8rB2M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032